<% breadcrumb :dashboard_invoices %>

<div class="dashboard-invoices-index">
    <div class="row menu-list-row">
        <div class="col-sm-3">
            <%= render partial: 'dashboard/left_menu' -%>
        </div>

        <div class="col-sm-9">
            <h3>我的发票管理</h3>
            <div class="notice"><%= flash[:notice] %></div>
            <div class="panel">
                <div class="panel-body padding-reset">
                  <div class="row margin-reset item">
                      <div class="row margin-reset">
                          <div class="col-xs-12">
                              <span>订单编号：<%= @order.order_no %></span>
                          </div>
                      </div>
                      <div class="row margin-reset column-col">
                          <div class="col-xs-6 title-and-img">
                              <img src="<%= image_path('cuxiao-1.png') %>" alt="" class="product-img">
                              <div class="title">
                                <% if @order.reserve %>
                                  <%= @order.reserve.survey_fee.name %>
                                <% else %>
                                  <%= @order.order_items.first.product.title %>
                                <% end %>
                              </div>
                          </div>
                          <% if invoice=@order.invoice %>
                            <div class="col-xs-2">
                                <%= get_invoice_type_str(invoice) %>
                            </div>
                            <div class="col-xs-4">
                                <div class="text-red">￥<%= @order.total_money %></div>
                                <div><%= invoice.title %></div>
                                <div><%= get_invoice_type_str(invoice) %></div>
                            </div>
                          <% else %>
                            <div class="col-xs-6">
                              <div>暂未开票</div>
                            </div>
                          <% end %>
                      </div>
                  </div>
                  <% unless @order.invoice %>
                    <hr>
                    <invoice></invoice>

                    <div class="row margin-reset">
                        <div class="pull-right">
                            <%= form_tag make_invoice_dashboard_invoices_path, method: :post, class: "create-order-form", id: 'order_form' do %>
                                <input type="hidden" name="order_id" value="<%= @order.id %>" id="order_id"/>
                                <input type="hidden" name="invoice_id" value="" id="input_invoice_id"/>
                                <button class="btn btn-primary" type="submit">我要开票</button>
                            <% end %>
                        </div>
                    </div>
                  <% end %>
                </div>
            </div>
        </div>
    </div>
</div>
